<template>
  <div class="advance-table-body">
    <!--搜索栏-->
    <el-form class="search-form--inset" ref="elForm" :model="queryParams" inline size="small" label-width="100px" label-position="left">
    </el-form>
    <!--操作栏-->
    <div class="table-operator">
    </div>
    <!--表格-->
    <el-table
      class="k-table"
      ref="table"
      @selection-change="handleSelectionChange"
      :data="tableList"
      v-loading="loading"
    >
      <el-table-column label="支付平台" align="left" prop="paymentTypeLabel" min-width="100px" show-overflow-tooltip />
      <el-table-column label="接入状态" align="left" prop="openStatus" :formatter="fOpenStatus" min-width="100px" show-overflow-tooltip />
      <el-table-column label="启用状态" align="left" prop="status" :formatter="fStatus" min-width="80" show-overflow-tooltip />
      <el-table-column label="修改时间" align="left" prop="updateTime" show-overflow-tooltip min-width="100"/>
      <el-table-column label="操作人" align="left" prop="updateBy" min-width="100px" show-overflow-tooltip />
      <el-table-column label="操作" align="left" width="150" fixed="right">
        <template #default="{ row }">
          <el-switch v-model="row.status" active-value="1" inactive-value="0" @change="switchChange(row)"></el-switch>
        </template>
      </el-table-column>
    </el-table>
    <!--<trust-pagination-->
    <!--  :total="total"-->
    <!--  :page-size.sync="queryParams.pageSize"-->
    <!--  :current-page.sync="queryParams.pageNum"-->
    <!--  @size-change="handleSizeChange" @current-change="handleCurrentChange"></trust-pagination>-->
  </div>
</template>
<script>
import { saTableMixin } from '@/views/custom/mixin/saTableMixin';
import ZDate from '@/views/custom/tool/z-date';
import request from '@/utils/request';
export default {
  name: "paymentAccessConfiguration",//支付接入配置
  components: {  },
  mixins: [saTableMixin],
  data() {
    return {
      rules: [],
      options: [],
    }
  },

  mounted() {
    this.requestData("pay_info/list","get",this.queryParams);
  },
  methods:{
    switchChange(row){
      this.requestDataEdit(row);
    },
    //网络-根据ID修改用户信息
    requestDataEdit(parm){
      this.loading = true;
      request({
        url:`/pay_info`,
        method:'put',
        data: parm,
      }).then(response =>{
        this.loading = false;
        this.$message.success(response.msg);
        this.refreshTableData();
      })
    },
    fOpenStatus(row, column, cellValue, index){
      return cellValue==='0' ? "未接入" : "已接入"
    },
    fStatus(row, column, cellValue, index){
      return cellValue === '0' ? "否" : "是";
    }
  }
}
</script>
